#include "main.h"
#include "NUC_Data.h"
#include "stm32f4xx.h"

#include "delay.h"
#include "can.h"
#include "rng.h"
#include "led.h"
#include "buzzer.h"
#include "uart3_rc.h"
#include "laser.h"
#include "shoot_pwm.h"
#include "remote_control.h"
#include "referee_data.h"
#include "STengine.h"

#include "FreeRTOSConfig.h"
#include "FreeRTOS.h"
#include "task.h"

#include "start_task.h"

void BSP_init(void);

int main(void)
{
    BSP_init();
	Task_begin();
	vTaskStartScheduler();
    while (1)
    { 

    }
}

void BSP_init(void)
{
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
	delay_init(configTICK_RATE_HZ);
	remote_control_init();
	Referee_Sys_Init();
	buzzer_init();
	led_configuration();
	laser_configuration();
	NUC_Sys_Init();
	RNG_Init();
	CAN1_mode_init(CAN_SJW_1tq, CAN_BS2_3tq, CAN_BS1_10tq, 3, CAN_Mode_Normal);
	CAN2_mode_init(CAN_SJW_1tq, CAN_BS2_3tq, CAN_BS1_10tq, 3, CAN_Mode_Normal);
	laser_on();
	SHOOTPWM_init(20000-1,168-1);
	STengine_init(20000-1,168-1);
}

